package com.zsj.enums;

/**
 * @Description:
 * @Author:
 * @Date:
 */
public enum ErrorCodeEnum {
    SUCCESS("0000", "请求成功"),
    ACCOUNT_ERROR("1001", "账号错误"),
    SIGN_FAIL("1002", "验签失败"),
    TIMESTAMP_ERROR("1003", "时间戳错误"),
    PARAM_ERROR("1004", "参数错误"),
    MOBILE_BLANK("2001", "⼿机号为空号"),
    MOBILE_NOT_SUPPORT("2002", "⼿机号为不⽀持充值的号码"),
    MOBILE_BLACK("2003", "⼿机号为⿊名单号码"),
    MOBILE_EXCEPTION("2004", "⼿机号异常"),
    MOBILE_TRANSFER("2005", "⼿机号为携转号码"),
    MOBILE_ARREARAGE("2006", "⼿机号⽋费"),
    PRODUCT_NOT_CONFIGURED("3004", "产品未配置"),
    PRODUCT_MAINTENANCE("3005", "产品维护"),
    ORDER_NOT_EXIST("4001", "订单不存在"),
    INTERFACE_LIMIT("5001", "接⼝限流"),
    SUPPLIER_FAIL("6001", "供应商处理失败"),
    AUTH_FAIL("10001", "权限校验失败"),
    ;

    private final String code;

    private final String msg;

    ErrorCodeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static ErrorCodeEnum findByCode(String code) {
        for (ErrorCodeEnum errorCodeEnum : ErrorCodeEnum.values()) {
            if (errorCodeEnum.getCode().equals(code)) {
                return errorCodeEnum;
            }
        }
        return null;
    }
}
